from flask import render_template, session, current_app, g

from info.models import User
from info.modules.news import news_blu

from info.utils.common import user_login_data


# xxxx：5000/news/3
@news_blu.route('/<int:news_id>')
@user_login_data
def news_detail(news_id):
    # 从g变量取出user对象
    user = g.user

    data = {
        "user_info": user.to_dict() if user else None,
    }
    return render_template('news/detail.html', data=data)
